
var table = layui.table,$ = layui.jquery,id = getQueryVariable("id");

//标签 判断是否有此角色
let warehouseLabel = getAllRolesByCurr("WarehouseManagementPrice");

table.render({
    elem: '#librarysavedetail',
    url: 'stock/getStockDetailByPage?id='+id,
    cols: [[
        {field: 'title', width: 120, title: '标题', sort: true},
        {field: 'invoiceNumber', width: 120, title: '单据编号', sort: true},
        {field: 'warehouseId', width: 120, title: '仓库名称', sort: true},
        {field: 'productCode', width: 120, title: '产品编码', sort: true},
        {field: 'specificationCode', width: 120, title: '规格编码', sort: true},
        {field: 'color', width: 120, title: '颜色', sort: true},
        {field: 'unitPrice', width: 120, title: '单价', sort: true},
        {field: 'money', width: 120, title: '金额', sort: true},
        {field: 'quantity', width: 120, title: '数量', sort: true},
        {field: 'productUnit', width: 120, title: '单位', sort: true},
        {field: 'createDate', width: 120, title: '创建时间', sort: true},
        {field: 'operator', width: 120, title: '操作人', sort: true},
        {field: 'inStorePerson', width: 120, title: '入库人', sort: true},
        {field: 'boxAmount', width: 120, title: '箱数', sort: true},
        {field: 'everyBoxAmount', width: 120, title: '每箱数量', sort: true},
        {field: 'productSpecExplanation', width: 120, title: '规格说明', sort: true},
        {field: 'memo', title: '备注',width: 80, sort: true}
    ]]
    ,id: 'librarysavedetailtableid'
    ,height: $(document).height() - $('#librarysavedetail').offset().top - 50
    ,page: true
    ,parseData: function(res){
        return {
            "code": res.status,
            "count": res.total,
            "data": res.data
        };
    }
    ,done: function (res, curr, count) {
        if(warehouseLabel){
            //标签:控制"单价"、"金额"
            //单价
            $("[data-field='unitPrice']").css("display", "none");
            //金额
            $("[data-field='money']").css("display", "none");
        }
    }
});